UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x/dzb81/d25rlANk8yarxkVQGHyVEMjEdxh7BjDeLDo=' 
WHERE 
  key_id = '6c647d643cfdaab3c143d10387b3efbb51426f3c99a846265187142141497dbf' 
  AND (
    token = 'x/dzb81/d25rlANk8yarxkVQGHyVEMjEdxh7BjDeLDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023