UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NjMQbgY+K0CuO3N2Su8WxuoFiDEsWtgqhO+64EDbzW4=' 
WHERE 
  key_id = '94119d6cf00fb05dac2ed37355978fa5369efce732f37056e682bba6bf473885' 
  AND (
    token = 'NjMQbgY+K0CuO3N2Su8WxuoFiDEsWtgqhO+64EDbzW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026