UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fF4jJok37/lGox4yelrLWbUkRXNuKrXyVfVKINrdi4w=' 
WHERE 
  key_id = 'b77b051ae967a2216ae14f1be39d7a36017cf5c1d154793e95d17b1002570ad1' 
  AND (
    token = 'fF4jJok37/lGox4yelrLWbUkRXNuKrXyVfVKINrdi4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016