UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n0YaA3IgndU7FHVQYFc4EITESEFCXK2n3NESKlANRxY=' 
WHERE 
  key_id = '617482d53aa9841fdc05cbc74379da0548fa11e64f934b27e54b91988fc5ac8b' 
  AND (
    token = 'n0YaA3IgndU7FHVQYFc4EITESEFCXK2n3NESKlANRxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028