UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jEcSUnhQyPLwKOlRxQDHahrG+jlh4ocUP4QDRQ+lrdM=' 
WHERE 
  key_id = 'd9932bf4d5e094d552f3a718f87680b5a58f4937a46afc5eafa693c284143935' 
  AND (
    token = 'jEcSUnhQyPLwKOlRxQDHahrG+jlh4ocUP4QDRQ+lrdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028