UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vdkyb/TVjDanLZ5tmD9X3uzQfa3a1dFJ6AwPnlwbTGQ=' 
WHERE 
  key_id = '6ec6e15b17de727540ff3939b52b216bee357da41c826b61a5d669592028de59' 
  AND (
    token = 'Vdkyb/TVjDanLZ5tmD9X3uzQfa3a1dFJ6AwPnlwbTGQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047