UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nrAqao4PrxNNxk+lxvdKcujNc7HUdBucOQqNyWq+TTA=' 
WHERE 
  key_id = '131b459ed11520bda6aece92effee34fde3f0752052acbc88fe7dd35ec176afe' 
  AND (
    token = 'nrAqao4PrxNNxk+lxvdKcujNc7HUdBucOQqNyWq+TTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049