UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W8c261Ny3YxBwAGnx/YbdtwT8rvVBj557oLZ+yQ9HyI='
WHERE
key_id = 'ebb5678629ee2866e7fac94d825ea0830a5dd665a561fccf4fabc4103e4caae6'
AND (
token = 'W8c261Ny3YxBwAGnx/YbdtwT8rvVBj557oLZ+yQ9HyI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)