UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kn04fPS2TaED1oqo+xqRax5BWmjAoFbt7NgocBNid7c='
WHERE
key_id = '31b2c8f1870a2833158025d85a737abdd7131af222d81a1d412c7fb383e7c34c'
AND (
token = 'Kn04fPS2TaED1oqo+xqRax5BWmjAoFbt7NgocBNid7c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)