UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NxzFsBMcYSE5+R3a3tCsLrGuqCV9d3EqWaIeuR1XHYc=' 
WHERE 
  key_id = 'a3170de91c807a6bbac01e0309ee4e130c64d2f9f91542dc5fd442c0fec173c0' 
  AND (
    token = 'NxzFsBMcYSE5+R3a3tCsLrGuqCV9d3EqWaIeuR1XHYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034