UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hitnPcUNUAjGX5dpTm//mpANYZMMrCGxWO83TdO7m9M=' 
WHERE 
  key_id = '1a0c86e75e2e694e2ce8bc6d9ce4eb2d31b96060bf379ecf73c35e754fda7d36' 
  AND (
    token = 'hitnPcUNUAjGX5dpTm//mpANYZMMrCGxWO83TdO7m9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038