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