UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qj7r7U8IK4ahJdIMBLa5O9xYX3nSMXXu9v5N6IVYKLs='
WHERE
key_id = '3af942ff34f80aaeb5cb5f35947aa1613975d842c0618f4726b4be0d49092b97'
AND (
token = 'qj7r7U8IK4ahJdIMBLa5O9xYX3nSMXXu9v5N6IVYKLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)