UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lcqyZo+Xgv3eJ0cwAa8aRYJFDFXqhXJ+doF8o+wY/Hc=' 
WHERE 
  key_id = '6e072ca67500ba1147435c7734e68055053fdd35c55439ad7e7aa5784688a303' 
  AND (
    token = 'lcqyZo+Xgv3eJ0cwAa8aRYJFDFXqhXJ+doF8o+wY/Hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035