UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NGWNJ/nujRndXsHkvOsejUGkTIozi9Y8CEa3pXn5alo='
WHERE
key_id = '0ee4175bf3ae73c94d4cedae810e7799e591cfe901102aa742262df5fc2f797c'
AND (
token = 'NGWNJ/nujRndXsHkvOsejUGkTIozi9Y8CEa3pXn5alo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)