UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TAUlfiDfVgMuLdXVpN19krJoI59povDN0bCRvZD7uKI=' 
WHERE 
  key_id = 'f5270c24b910c43146634d039a45f4bb9bc6130b4f8f0426456a3465d874a2d3' 
  AND (
    token = 'TAUlfiDfVgMuLdXVpN19krJoI59povDN0bCRvZD7uKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047