UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Dy2YdZpSY1aW5P4F1TZpKUmeiKzcc9THLqwmh++SlxQ='
WHERE
key_id = 'c6f9d6ee3473fc0c7dc885f64059b5a0baffa6c91a11db3397013c34f7367cf9'
AND (
token = 'Dy2YdZpSY1aW5P4F1TZpKUmeiKzcc9THLqwmh++SlxQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)