UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KAEGzjceeia20goVMbYyxonUt8TJj13m5H2JeRzLmfc=' 
WHERE 
  key_id = 'fcff6a1c6ec2182deb7858f9d2f2d9832321a955f2e6ec66721a12387a812609' 
  AND (
    token = 'KAEGzjceeia20goVMbYyxonUt8TJj13m5H2JeRzLmfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021