UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VKErY9UIlCuqr0EIOW/ADrz18BG3E+YBMYIwGZCSUD0='
WHERE
key_id = 'f198c7e86a41d35562ff4c764244992c1a4bb0d2edb2425f6f9c7e99b2cb0c2f'
AND (
token = 'VKErY9UIlCuqr0EIOW/ADrz18BG3E+YBMYIwGZCSUD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)