UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9hVvHv0axraIGb9VWtjqeBLl9njoTxKRVLnP4YsvZnI=' 
WHERE 
  key_id = '688e99c8ef72262cacacb4344270d8eef07ff389072d163c72131eab3af96069' 
  AND (
    token = '9hVvHv0axraIGb9VWtjqeBLl9njoTxKRVLnP4YsvZnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047