UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h2AorbKtLKcWNe6uMBlj5IUNsUUqbxNZMXNYOMuDtJI=' 
WHERE 
  key_id = '802a829c497f129be4874520433f456a777ee0d1867e6030141aef683baf678d' 
  AND (
    token = 'h2AorbKtLKcWNe6uMBlj5IUNsUUqbxNZMXNYOMuDtJI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038