UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IOg7X71MAGOMOoFKARvu9BNxTyxqbIYBFTvyjszc4K4='
WHERE
key_id = '6c7843c31b4b6dd6812544ac6729070578d2ff4f977339d649b7ff45ccb192a2'
AND (
token = 'IOg7X71MAGOMOoFKARvu9BNxTyxqbIYBFTvyjszc4K4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)