UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm6XEg6bRNwxKv72zL6XFlaQjUSLdWBmWNf5XHFKRGMA='
WHERE
key_id = 'cd98fe16a1502fbb09d5ddfe28f4ef09834377f88d9e558533db3c77a7141105'
AND (
token = 'm6XEg6bRNwxKv72zL6XFlaQjUSLdWBmWNf5XHFKRGMA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)