UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OWJQYcQ2jl/Hk+4rHKTJLSbMDvqN2JEWD9jMUxrdaNo=' 
WHERE 
  key_id = 'dc265e5262b3383dcfb9a635cf5f810a46cfa288378037401c6f1d03bce60b86' 
  AND (
    token = 'OWJQYcQ2jl/Hk+4rHKTJLSbMDvqN2JEWD9jMUxrdaNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038