UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WfPZCp9xzZtChKt9IfBC7W2eJELy9gyP8QlVtieWOkc='
WHERE
key_id = '188c8041cc08bc92e9b09b54cbb956328be9e49545b9e41ded638f89b7e3868b'
AND (
token = 'WfPZCp9xzZtChKt9IfBC7W2eJELy9gyP8QlVtieWOkc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)