UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BYAEgH90ZbbL/s+rHEoRpGm5t7pDuJf39PD4NAmN7fA=' 
WHERE 
  key_id = '113ae2632f6ede75858adac792131dacd9219aea5f3e5530e1ce1aef3a1354d4' 
  AND (
    token = 'BYAEgH90ZbbL/s+rHEoRpGm5t7pDuJf39PD4NAmN7fA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025