UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'svkNLqolPcOODqPpc6+kP2fTwYQwax4WEl6ohw6/s0o=' 
WHERE 
  key_id = '9aeeac8fe3143ad0401b9d68bd35870fbe38abcd77699575e1830acf20bf8198' 
  AND (
    token = 'svkNLqolPcOODqPpc6+kP2fTwYQwax4WEl6ohw6/s0o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068