UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BCDA1+9OBE7YerZYl93Jzjf4qG3HnatFxG7/5stewpw=' 
WHERE 
  key_id = '6652ec9053e9e942aa5928e67de921df06d1644bbac6cfb63b90b88442565127' 
  AND (
    token = 'BCDA1+9OBE7YerZYl93Jzjf4qG3HnatFxG7/5stewpw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028