UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WmSba7B0yQrSrBnynI3UxUNqJ0ZJXzW/PZtUCQQ5W9w='
WHERE
key_id = '64ec4da16a5cd78ffb58707c182ad410bd2aee6c6736e0f475b82f4281f5465e'
AND (
token = 'WmSba7B0yQrSrBnynI3UxUNqJ0ZJXzW/PZtUCQQ5W9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)