UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pIUdqRueKiW9cO1uDu9UdTdYMuPZozHnd4V+vVTaEbA=' 
WHERE 
  key_id = '34fd5878ece94de6ef0b13556f0ecea430b0823c1afd68e291e9c7a2d63ff737' 
  AND (
    token = 'pIUdqRueKiW9cO1uDu9UdTdYMuPZozHnd4V+vVTaEbA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044