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