UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z2QXy2cQRzlwKutPYrDGC5wTFsLGZXciZZFK0wuXR+E='
WHERE
key_id = '52a3e18e58f7c6b3de59d80ca46c49d8de7f8a360eb43f789cf580b7a71f38ee'
AND (
token = 'z2QXy2cQRzlwKutPYrDGC5wTFsLGZXciZZFK0wuXR+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)