UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c6fmmQtm7ztsGDJeFkGNqEXytX+XljdEWKGWf7DQFQQ=' 
WHERE 
  key_id = '8496876e87620e78cf1a8819dab723aa17e66ea6c2222907e5a341adb844b136' 
  AND (
    token = 'c6fmmQtm7ztsGDJeFkGNqEXytX+XljdEWKGWf7DQFQQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024