UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8D8AqjPekHZg3mLnJqIq4qLVyTWCIpcCBXdbCqNmV+4='
WHERE
key_id = 'e2bbee9992eb2084971fb44370ce105b320bcb1366c1e0a618943b5d5a46cb0e'
AND (
token = '8D8AqjPekHZg3mLnJqIq4qLVyTWCIpcCBXdbCqNmV+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)