UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uOsFn9ks3DqCd3KNKuGCMXbvl19k9PstmlPDx3gJcrU=' 
WHERE 
  key_id = '53e79f0ddf9d5919a9afafc21959de4034aae5d4435b49f436ce3f7d9906f538' 
  AND (
    token = 'uOsFn9ks3DqCd3KNKuGCMXbvl19k9PstmlPDx3gJcrU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034