UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G3lWO3sX6wHZ31yLJq8nqWTlU76ZMYgclOJHy8GH3Ec=' 
WHERE 
  key_id = '3d55fa45bdd2703b044228316fcd9e1968af127e7ce84b121085d49cee216b80' 
  AND (
    token = 'G3lWO3sX6wHZ31yLJq8nqWTlU76ZMYgclOJHy8GH3Ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039