UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vKZOvnzuDR+vsfKVLXK5NsC68v7ksHE3CDZhaY3VSfw='
WHERE
key_id = 'a8d06ff9e1e25829bd1b74c8f7f6c41435f784d31726f3df1952b446bf8346be'
AND (
token = 'vKZOvnzuDR+vsfKVLXK5NsC68v7ksHE3CDZhaY3VSfw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)