UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZtbW6ZWELSqWBXkyKDSHV55TuwqtmM7z6M4YrdDlbuM='
WHERE
key_id = '1040a1ab328aaabd6086890ae5d4d97151747448f35e5daccc925a0168193719'
AND (
token = 'ZtbW6ZWELSqWBXkyKDSHV55TuwqtmM7z6M4YrdDlbuM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)