UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BfHEezXgXGww0Vctd4Bug/aDbpscNPdrSc3NWaMihvk=' 
WHERE 
  key_id = 'd0e7027c8346866e28b95cd664f4929b18e995ee2ca38240d59d350b642e1f8f' 
  AND (
    token = 'BfHEezXgXGww0Vctd4Bug/aDbpscNPdrSc3NWaMihvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021