UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BNxvVl1f2ps94kO+A+pvHtzL7Ad+ReU25EQhQN93ghg='
WHERE
key_id = '16e062b7d22f7dd351d5e8221df3025429c700530117af42b604817963a55dca'
AND (
token = 'BNxvVl1f2ps94kO+A+pvHtzL7Ad+ReU25EQhQN93ghg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)