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