UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd8jmLapPfAh/kladqWbX+xSPGZEoAH9ZLn8slNQl5CY='
WHERE
key_id = 'b34eb596b7b324fa8934c643ceb97defb16437e68c7fdb75bce6f78b21040fb3'
AND (
token = 'd8jmLapPfAh/kladqWbX+xSPGZEoAH9ZLn8slNQl5CY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)