UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aTT0AaI6K/81x5q28Ji7BRU5zpjZUAva6WkqZQxKlGA='
WHERE
key_id = 'f76ac964270445cda8ecdd4822dbf148c4043e95ffa88be1f04084881d3deb21'
AND (
token = 'aTT0AaI6K/81x5q28Ji7BRU5zpjZUAva6WkqZQxKlGA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)