UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e6KZcBFIjSS1BDRqukYzptzwE9DLYcz6HtgPUqNSaUk='
WHERE
key_id = '3e746e7f5ea370a1091f69722583209e255f351c329b324b11ba9c5aa1edf119'
AND (
token = 'e6KZcBFIjSS1BDRqukYzptzwE9DLYcz6HtgPUqNSaUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)