UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KDLSyI3ykHeFNq2egKYcYaIZA6elqiknHgDzn4Y9f2s='
WHERE
key_id = '9ddd12152f9b9c95a2e15930863c1f99a894db9752dc7700f0df75a7bef1288a'
AND (
token = 'KDLSyI3ykHeFNq2egKYcYaIZA6elqiknHgDzn4Y9f2s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)