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

Query time 0.00033