UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '80a4TBoWvhJEmWxQDW+zDNz/vtl9EplYqnmeJ9x/TuY=' 
WHERE 
  key_id = '0367093df2add35f1a384060a00e7faebbc715093e99ad9faa57fa38f08d24d0' 
  AND (
    token = '80a4TBoWvhJEmWxQDW+zDNz/vtl9EplYqnmeJ9x/TuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039