UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9VpXMyf8fcgc+1LvXyFxXq9OtWcbTeSQlMHJgorKTYk='
WHERE
key_id = '31751b629dcaa5864c90401b1e3cdd24a36fd0cc1c73d18327153118588a6ba5'
AND (
token = '9VpXMyf8fcgc+1LvXyFxXq9OtWcbTeSQlMHJgorKTYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)