UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aWb2ZnzwrrFN/bB9F9J8mFSmLdnlWjBuV0x4uD4NyDE=' 
WHERE 
  key_id = '72f4912b4beab2e07af8a30dd5055d1afe73d2df5bd5516a80b563a99fa0a865' 
  AND (
    token = 'aWb2ZnzwrrFN/bB9F9J8mFSmLdnlWjBuV0x4uD4NyDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026