UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bd8aHplAPvYTWe+dyJi0vg2oihm7V/4idwFt96h8xEU=' 
WHERE 
  key_id = '8d4e111628a5fd93b25796b7796aa931dd9d3b0f7906346db9a690508de34203' 
  AND (
    token = 'bd8aHplAPvYTWe+dyJi0vg2oihm7V/4idwFt96h8xEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028