UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KMDNQWUGLSEHq00InBQZi/AtnX5gPwT9jSs8cfiP33o=' 
WHERE 
  key_id = '9dbed9f923bbfa2b827aca51748d6a2e35cd42b59a50432a46c6b02d20ca8111' 
  AND (
    token = 'KMDNQWUGLSEHq00InBQZi/AtnX5gPwT9jSs8cfiP33o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022