UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KkXTynPR4f4hX693vuSM9CQTayeVcKcsqvT3buwMiqk='
WHERE
key_id = '17b71ae12be474ecbcec5873751039df86c73e60b74c1eb4f852f93949e7185d'
AND (
token = 'KkXTynPR4f4hX693vuSM9CQTayeVcKcsqvT3buwMiqk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)