UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SNubdqIHGG0Ezc2HkHeK+0pkoJ/2XEO5DYsFGJKCL+M=' 
WHERE 
  key_id = 'ff63e3fb174d42da0a7d31c907c60363d7843189e0f9a46fed9592411aa6fa0d' 
  AND (
    token = 'SNubdqIHGG0Ezc2HkHeK+0pkoJ/2XEO5DYsFGJKCL+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031