UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'grOfXVDtpnzhxIAIuE16HNtAN41W62cOm47zZDfcWKE=' 
WHERE 
  key_id = '0c407ce53fdb42eed7704f711068c753d99b65390cc52070dfea70680567bbe7' 
  AND (
    token = 'grOfXVDtpnzhxIAIuE16HNtAN41W62cOm47zZDfcWKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031