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