UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3t8sJ/2RGS6d9HfInp3RHxcNEBibp2qWCvJQ4/BGs54=' 
WHERE 
  key_id = '77a9adfa9f8e13d7aaff9fef90e524b0acd223913effb10d8e17454b377d81c2' 
  AND (
    token = '3t8sJ/2RGS6d9HfInp3RHxcNEBibp2qWCvJQ4/BGs54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027