UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5t6jDqeY6HvgI3T2ncX4CgmC4eWrzH/CsHUfxaWpoSo='
WHERE
key_id = 'f765ed13b92a99ef3009d6a1023a8d2af53b7d58ab538de3e49ff5e716beb0f8'
AND (
token = '5t6jDqeY6HvgI3T2ncX4CgmC4eWrzH/CsHUfxaWpoSo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)