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