UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X1kLb8lvsRmUe83aVAr49L9nprnNB8nYEISpyjs2eLU='
WHERE
key_id = '28052dc3bddfb1e203fa6443aba6f1399f71d7b6f15973f36b42d378e750f8d3'
AND (
token = 'X1kLb8lvsRmUe83aVAr49L9nprnNB8nYEISpyjs2eLU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)