UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dQLQqqITkvkGSD4n5iWC8lN0Os1FJvkdz2o27Tow0Qg='
WHERE
key_id = 'cc1511fc7b87c6bdcf5f0fef2acc9ae77cb9740b169e109717851d437291b706'
AND (
token = 'dQLQqqITkvkGSD4n5iWC8lN0Os1FJvkdz2o27Tow0Qg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)