UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k6Ei/0CYISd/d0DsFnrg6TOMC/jFXS8fh2M90NoRKHM=' 
WHERE 
  key_id = 'beda1f8d93a52176ea46495fb59c751943e6c2b596a4982852d26f8efa853336' 
  AND (
    token = 'k6Ei/0CYISd/d0DsFnrg6TOMC/jFXS8fh2M90NoRKHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040