UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wBilHUPxNjD3WFpFx3Zrf/btvEtrf3/M0+G6aK/dB9Y=' 
WHERE 
  key_id = 'a47ad55bd270367c6713e42d8649d5f6f54f92a4735d8712453710c8a3a2cdf5' 
  AND (
    token = 'wBilHUPxNjD3WFpFx3Zrf/btvEtrf3/M0+G6aK/dB9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044