UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xsJeLjtCLDt5+lhUgsGlS1OXwqGWSJ0kmhTdSDuwKYY=' 
WHERE 
  key_id = '461228865dcef6d21de63bb43c679001bc00a78eb69e3fc8fc5f3164bda0e515' 
  AND (
    token = 'xsJeLjtCLDt5+lhUgsGlS1OXwqGWSJ0kmhTdSDuwKYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022