UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yZCQK0GmyAWsswbvP/Q6jbkcJDznrecYaI7q63A+jCw=' 
WHERE 
  key_id = 'ff61ff00f6b97b1b7e53a3d0406a6c8e304f231f781784ee214e1d8750a7dedf' 
  AND (
    token = 'yZCQK0GmyAWsswbvP/Q6jbkcJDznrecYaI7q63A+jCw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040