UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qIUnF/+bdPbYX4utm4ohRpDBgGXcr33jta06SXqy5rY='
WHERE
key_id = '7177f1334201ac4e6fe3547f5bf38358b9f85c753f03c2617708eb586cc48fb8'
AND (
token = 'qIUnF/+bdPbYX4utm4ohRpDBgGXcr33jta06SXqy5rY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)